<?php include _include(ADMIN_PATH.'view/htm/header.inc.htm');?>
<link rel="stylesheet" href="../assets/vendor/inputmask/css/inputmask.css" />
<div class="row">
    <div class="col-12">
        <div class="btn-group mb-3" role="group">
            <?php echo admin_tab_active($menu['ad']['tab'], 'ad');?>
        </div>
    </div>
</div>

<div class="row">
    <div class="col-12">
        <div class="card">
            <div class="card-body">
                <form action="<?php echo url('other-ad_list') ?>" method="POST" id="form">
                    <div class="form-control w-50 mt-2">
                        <input type="file" class="" name="ad_1" id="ad_1">
                        <label class="" for="ad_1">上传广告图一</label>
                    </div>
                    <div class="form-control w-50 mt-2">
                        <input type="file" class="" name="ad_2" id="ad_2">
                        <label class="" for="ad_2">上传广告图二</label>
                    </div>
                    <div class="form-control w-50 mt-2">
                        <input type="file" class="" name="ad_3" id="ad_3">
                        <label class="" for="ad_3">上传广告图三</label>
                    </div>
                    <div class="form-group w-50 mt-2">
                        <button type="submit" class="btn btn-primary btn-block" id="submit" data-loading-text="<?php echo lang('submiting');?>...">保存</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

<?php include _include(ADMIN_PATH.'view/htm/footer.inc.htm');?>

<script>
    var jform = $('#form');
    var jsubmit = $('#submit');
    jform.base64_encode_file();
    jform.on('submit', function() {
        jform.reset();
        jsubmit.button('loading');
        var postdata = jform.serializeObject();
        $.xpost(jform.attr('action'), postdata, function(code, message) {
            if(code == 0) {
                alert(message);
                jsubmit.button(message);
            } else if(xn.is_number(code)) {
                alert(message);
                jsubmit.button('reset');
            } else {
                jform.find('[name="'+code+'"]').alert(message).focus();
                jsubmit.button('reset');
            }
            /*
            if(code == 0) {
                jsubmit.button(message).delay(1000).location(referer);
            } else if(code == 'email') {
                jemail.alert(message).focus();
                jsubmit.button('reset');
            } else if(code == 'password') {
                jpassword.alert(message).focus();
                jsubmit.button('reset');
            } else {
                alert(message);
                jsubmit.button('reset');
            }*/
        });
        return false;
    });
    
</script>